<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<!-- 引入实体类Users -->	
<jsp:useBean id="loginUser" class="org.po.Users"></jsp:useBean>
<!-- 引入业务逻辑类UsersDAO -->
<jsp:useBean id="userDAO" class="org.dao.UsersDAO"></jsp:useBean>

<!-- 为javaBean loginUser设置属性，使用表单自动设置全部的值 -->
<jsp:setProperty property="*" name="loginUser"/>

<!-- 调用业务逻辑代码 -->
<%
	request.setCharacterEncoding("utf-8");//防止中文乱码
	if(userDAO.isUserLogin(loginUser)){
		//如果用户登录成功则向session中设置用户名和密码
		session.setAttribute("username", loginUser.getUsername());
		session.setAttribute("password", loginUser.getPassword());
		//请求转发
		request.getRequestDispatcher("login_success.jsp").forward(request, response);
	}else{
		//重定向
		response.sendRedirect("login_failure.jsp");
	}
%>